#include "CLGene.h"

CLGene::CLGene(Box * pBox) : Gene(pBox)
{
	this->m_pBox=pBox;
}

CLGene::~CLGene(void)
{
}

void CLGene::makeExpressionTree()
{
	vector<string> gen = this->stringToVec();
	CLExpressionNode* nRoot;
	//vector<string>=
	
	if(this->m_pBox->isFunction(gen[0][0])){
		CLOperNode * OperRoot = new CLOperNode(this->m_pBox,gen[0]);
		nRoot = OperRoot;
		for (int i=1;i<this->m_pBox->geneLength;i++){
			string tmp=gen[i];
			nRoot->addNode(tmp.c_str());
		}
	}
	else{
		CLVarNode * VarRoot = new CLVarNode(this->m_pBox,gen[0]);
		nRoot = VarRoot;
	}



	

	this->m_pETRoot = nRoot;
}
